package com.bree.erp.jsf.vo;

import com.bree.erp.entity.CrudId;
import com.bree.erp.entity.ItemRequest;
import com.bree.erp.entity.PartUnit;
import com.bree.erp.entity.PurchaseRequisition;

public class ItemRequestDT implements CrudId<Long> {

	private static final long serialVersionUID = 1L;
	
	private Long id;
	private Long prId;
	private Long partUnitId;
	private int itemNumber;
	private String description;
	private String brand;
	private String partNumber;
	private double quantity;
	private double orderedQuantity;
	private String unit;
	private double inStock;
	private double available;

	public ItemRequestDT() {

	}

	public ItemRequestDT(ItemRequest itemRequest) {
		
		this.id = itemRequest.getId();
		this.itemNumber = itemRequest.getItemNumber();
		
		PurchaseRequisition pr = itemRequest.getPurchaseRequisition();
		if(pr != null) {
			prId = pr.getId();
		}

		PartUnit partUnit = itemRequest.getPartUnit();
		if (partUnit != null) {
			this.partUnitId = partUnit.getId();
			this.description = partUnit.getShortName();
			this.brand = partUnit.getShortBrand();
			this.unit = partUnit.getShortUnit();
			this.partNumber = partUnit.getPart();
		}
		
		this.quantity = itemRequest.getQuantity();
	}

	/**
	 * @return the itemNumber
	 */
	public int getItemNumber() {
		return itemNumber;
	}

	/**
	 * @param itemNumber
	 *            the itemNumber to set
	 */
	public void setItemNumber(int itemNumber) {
		this.itemNumber = itemNumber;
	}

	/**
	 * @return the description
	 */
	public String getDescription() {
		return description;
	}

	/**
	 * @param description
	 *            the description to set
	 */
	public void setDescription(String description) {
		this.description = description;
	}

	/**
	 * @return the brand
	 */
	public String getBrand() {
		return brand;
	}

	/**
	 * @param brand
	 *            the brand to set
	 */
	public void setBrand(String brand) {
		this.brand = brand;
	}

	/**
	 * @return the partNumber
	 */
	public String getPartNumber() {
		return partNumber;
	}

	/**
	 * @param partNumber
	 *            the partNumber to set
	 */
	public void setPartNumber(String partNumber) {
		this.partNumber = partNumber;
	}

	/**
	 * @return the quantity
	 */
	public double getQuantity() {
		return quantity;
	}

	/**
	 * @param quantity
	 *            the quantity to set
	 */
	public void setQuantity(double quantity) {
		this.quantity = quantity;
	}

	/**
	 * @return the orderedQuantity
	 */
	public double getOrderedQuantity() {
		return orderedQuantity;
	}

	/**
	 * @param orderedQuantity
	 *            the orderedQuantity to set
	 */
	public void setOrderedQuantity(double orderedQuantity) {
		this.orderedQuantity = orderedQuantity;
	}

	/**
	 * @return the unit
	 */
	public String getUnit() {
		return unit;
	}

	/**
	 * @param unit
	 *            the unit to set
	 */
	public void setUnit(String unit) {
		this.unit = unit;
	}

	/**
	 * @return the inStock
	 */
	public double getInStock() {
		return inStock;
	}

	/**
	 * @param inStock
	 *            the inStock to set
	 */
	public void setInStock(double inStock) {
		this.inStock = inStock;
	}

	/**
	 * @return the available
	 */
	public double getAvailable() {
		return available;
	}

	/**
	 * @param available
	 *            the available to set
	 */
	public void setAvailable(double available) {
		this.available = available;
	}

	/**
	 * @return the id
	 */
	public Long getId() {
		return id;
	}

	/**
	 * @param id the id to set
	 */
	public void setId(Long id) {
		this.id = id;
	}

	/**
	 * @return the partUnitId
	 */
	public Long getPartUnitId() {
		return partUnitId;
	}

	/**
	 * @param partUnitId the partUnitId to set
	 */
	public void setPartUnitId(Long partUnitId) {
		this.partUnitId = partUnitId;
	}

	/**
	 * @return the prId
	 */
	public Long getPrId() {
		return prId;
	}

	/**
	 * @param prId the prId to set
	 */
	public void setPrId(Long prId) {
		this.prId = prId;
	}
}
